We want to find the optimal policy \(\pi\) for a finite markov decision process (MDP)
We have a feedback loop as such
In particular, we may define policies \(\pi(a \mid s)\) that determine what actions the agent takes at each state.
Then, we will try and maximize the discounted return \(G^{(\pi)}_t = \sum_{k=t+1}^T \gamma^{k - {t + 1}} R_k\). Note that because these are probabilistic policies, we want \(\mathrm{max}_\pi \mathbb{E}[G^{(\pi)}_t]\).
Finally, it is useful to define the value functions that we will be working with
We shall simulate one possible example of a (deterministic) Markov Decision Process.
Suppose we have \(\mathcal{S} = \{1, 2, 3\}\), \(\mathcal{A} = \{1, 2\}\). Further, suppose our reward function \(p(R_t = r \mid S_t = s, A_t = a)\) is as follows
And our state transitions are
We can set our starting distibution to be uniform. Finally, we define the terminal state to occur after \(N\) time steps.
For example, we may choose a deterministic policy \(\pi(1 \mid s) = 1\), and \(\pi(2 \mid s) = 0\).
each with probability \(\frac{1}{3}\).